<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        性别：{{sex|formatterSex|formatterSex1}}
    </div>
    <script src="../vue.js"></script>
    <script>
        new Vue({
            el:'#app',
            data () {
                return {
                    sex:1,
                }
            },
            filters: {
                formatterSex(val){
                    if(val==1){
                        return '男';
                    }
                    else if(val==2){
                        return '女';
                    }
                    else{
                        return '未知';
                    }
                },
                formatterSex1(val){
                    if(val=='男'){
                        return '男性';
                    }
                    else if(val=='女'){
                        return '女性';
                    }
                }
            }
        })
    </script>
</body>
</html>